﻿    <script type="text/javascript">
        $(document).ready(function () {
            var p = new singlepage();
            p.c = "Way.Bus.WMS.ST.Controllers.StockInfoController";
            p.applyTo = "t1";
            p.onInited = function (p) {
                var t = p.datasource.tool;
                var textid = p.name + "_input";
                var cmdid = p.name + "_search";
                var cmd = "<span><label>序列号</label><input id='" + textid + "' type='text'/><a id='" + cmdid + "'>查询</a></span>";
                $(t.commandTd).append(cmd);
                $("#" + cmdid).linkbutton({
                    iconCls: 'icon-search',
                    text: "查询序列号"
                });
                $("#" + cmdid).bind('click', function () {
                    var text = $("#" + textid).val();
                    if (text != null && text != "") {
                        var e = p.datasource.post("GetSnTable", "sn=" + text);
                        if (e && e.error) {
                            $.messager.alert('异常', e.errormsg, 'error');
                        }
                        else {
                            p.datasource.onLoad(e);
                        }
                    }
                });
            }
            p.init();
        });
        
        function import1(data) {
            try {
                $('<div id="d2"><div id="d3"/></div>').appendTo($("#temp"));
                var p1 = new datasource();
                p1.c = "Way.Bus.Controllers.ExcelDRController";
                p1.applyTo = "d3";
                window.ddata = data;
                window.pdata = p1;
                p1.init();
                
                $('#d2').dialog({
                    title: "导入数据",
                    collapsible: false,
                    resizable: false,
                    width: 700,
                    height: 400,
                    cache: false,
                    href: "Views/manager/Exceldr.htm",
                    onClose: function () {
                        $(this).panel('destroy');
                        $("#temp").empty();
                        window.ddata = null;
                    }
                });
            } catch (e) {

            }
        }

        function emport1(data) {
            $('<div id="d2"><div id="d3"/></div>').appendTo($("#temp"));
            var p2 = new singlepage();
            p2.c = "Way.Bus.WMS.ST.StockInfoExcelDC";
            p2.applyTo = "d3";
            //p1.outc = form.parent.c;
            //p1.ssss = data;
            window.ddata = data;
            window.pdata = p2;
            p2.init();
            $('#d2').dialog({
                title: "导出数据",
                collapsible: false,
                width: 400,
                height: 320,
                cache: false,
                href: p2.datasource.url,
                onClose: function () {
                    $(this).panel('destroy');
                    $("#temp").empty();
                    window.ddata = null;
                }
            });
        }
      </script>
<div id="t1"></div>
<div id="t2"></div>
